
using NUnit.Framework;
using System;
using System.Collections.Generic;
using UnityEngine;

public class ViewManager
{
    /// <summary>
    /// -32768 - 32767
    /// </summary>
    public int order;

    static ViewManager instance = new ViewManager();
    static public ViewManager Instance=> instance;


    public void Init()
    {
        //注册所有界面
        //这里 直接反射获取 自动化 

        LoginViewController.Instance.Init("UI/LoginCanvas", true,false);
        LoadingViewController.Instance.Init("UI/LoadingCanvas", true, false);
        MainViewController.Instance.Init("UI/MainCanvas", true, false);
        BagViewController.Instance.Init("UI/BagCanvas", true, false);
    }


    List<string> open_view = new List<string>();    
    internal void OnViewChange_Begin(string resPath, bool active)
    {
        // 公共的导航栏
        if(open_view.Contains(resPath) == false)
        {
            open_view.Add(resPath);
        }


        //暂时不知道干嘛的
    }

    internal void OnViewChange_End(string resPath, bool active)
    {
        // 公共的导航栏
        //暂时不知道干嘛的
        if (open_view.Contains(resPath) == false)
        {
            open_view.Remove(resPath);
        }
    }

    public Action OnUpdate;
    public void Update()
    {
        OnUpdate?.Invoke();
    }
}